home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Internet software / WebCamToo v1.2.1 / WebCamToo v1.2.1 Documentation next >
Text File  |  1996-06-06  |  24KB  |  285 lines

  1. WebCamToo v1.2.1
  2.  
  3. Quick note
  4. WebCamToo is very very easy to setup and use.  I have made the instructions a little verbose because I haven't a clue how to write instructions.  Also, I want to make sure you know what everything does.  You don't need to know but its much nicer to know how to get the most out of it.
  5.  
  6. Quick Demo
  7. To see a quick demo, point your web browser to the following URL:
  8. http://www.mmcorp.com/~binky/webcam2.html
  9.  
  10. What is WebCamToo
  11. WebCamToo is a simple application that lets you add live video (stills or animated) into your web pages.  Anybody can take advantage of the video that you are broadcasting.  WebCamToo was originally designed to work with the Connectix Quickcam, although it does work with any Quicktime video input device.
  12.  
  13. Do I need any special Software to view the images?
  14. To view the images, you need a web browser.  If you want to see the server push image stream then you need Netscape.  I strongly suggest using Netscape.
  15. You don't need any plugins!  You don't need any codecs!
  16. WebCamToo serves images to ALL platforms.
  17.  
  18. Memory Requirements
  19. Well, depending upon how many cameras are being supported and how many people are currently connected...err
  20. Look, I set the meory partition to 1Mb and theres usually still around 1Mb free (with 3 cameras).  It depends on a lot of things.  Give it 2Mb and see if it complains...if you have memory left around then stick it at 4Mb.
  21. Don't use virtual memory...it will slow the program down rather drastically.
  22.  
  23. Minimum Spec Machine
  24. A PowerMac
  25. MacTCP 2.0.6 or Open Transport.
  26. A TCP network (you can run it on internal LANs as well as the InterNet)
  27.  
  28. Exciting News !!!
  29. I got an email from the editor of the Japanese MacUser magazine.  WebCamToo will be on next months (July 96) cover CDROM.  I am very honoured at this!
  30. I got an email from AMUG asking if they can bundle WebCamToo on one of their shareware CDROMS.  I said no because they charge for the CD (ie. they charge more than just the production and distribution costs).  The program is free and I object to people making money off it.  They said I could get a copy of the CD for the distribution costs, $10.  Somehow I don't think it costs $10 to send a CDROM from the States to the UK.  I find this insulting!
  31.  
  32. On last weeks show...
  33. Since v1.2 there have been a few minor changes, hence only a minor revision number change.  Here is a quick rundown of the new features added in 1.2.1:
  34. •status window now shows peak, current and total connection counts
  35. •toggle-able reverse DNS lookups on ip addresses (be *VERY* careful with this one...it can make things extremely slow)
  36. •toggle-able log file (logs open/close connection with ip/symbolic address and connection duration)
  37. •stuck in a carriage return char in the captions.  The '|' (pipe) char will be treated as a newline char.
  38. •fixed caption so it isn't rescaled with the image (image is rescaled then caption is drawn). ie. small image still shows a legible caption
  39. •I used to distribute the program with the number of streams set to 20.  I have reduced this now to 10 because people were running out of streams when they ran a webserver on the same machine.  If you want more (or less) streams then email me (address below) and I'll send you a custom version.
  40.  
  41. Some thoughts...
  42. I tried a few timiing things to speed the open-grab-close process and I get, on average, a turnaround time of 5 seconds.  Thats how long WebCamToo takes to go through the whole process.  This puzzles me cuz the actual compression/imageMunging bit takes around 1 second...that leaves around 4 seconds of, err, sending?  I dunno really.  I'll see what I can do to bump this up.  I did optimise the process a little (knocking up to 5 seconds off the turnaround time) but that still leaves a considerable amount of time spent doing...something.
  43. I am going to rewrite WebCamToo again from scratch at some point.  This is for a number of reasons.  The program was not meant to get quite as advanced as it has (yes, it _is_ advanced) and the code is becoming a trifle hacky.  I keep cleaning it up and making it "better" and faster but a total rewrite is how I like to do things.  You probably won't notice it when I do apart from the speed at which it operates (it'll be somewhat faster). 
  44. I thought about making WebCamToo into a webserver.  This may sound rather dumb, but it already is a webserver.  It doesn't serve HTML files but it could quite easily do so.  I also want to make it possible to write CGI's for it so that you can do your own image manipulation stuff (not that anyone WILL write them, but it'll be a nice challenge for me).  That won't be for a little while yet.
  45. I want to switch over to using Broken Transport (its meant to be faster) but I shan't until I've run some tests and done some neato libraries first.  That will be a major revision change.
  46. I am considering releasing the source code.  I'd have to clean it up for public consumption but I think that it is nearing that time when the public should be able to get the code and "have a go at it", as it were.  I will release it soon, but not just yet (sorry).
  47.  
  48. Out to lunch?
  49. WebCamToo (WCT) could easily be so much more than just a video server.  The previous version let you broadcast your desktop (image) so that people could see what you were doing (without being able to read the text!).  It was kinda dumb but it was still interesting to watch.  I want to make WCT a general server program.  Something fast and unobtrusive so you can run it and it sits in the background of any mac (even one used for general stuff like my development machine at work) serving anything you like.  I don't just mean things like web documents, ftp stuff, telnet logins (possibly...why not?) and the like but other stuff too.  I need to think more about this and I welcome any suggestions you have.  This may seem crazy because theres plenty of server machines and software out there.  You may think its the "re-inventing the wheel" syndrome but I disagree.  Anyway, even if it is I don't really care because at least I'll know how to do it and I will understand how it works.  That is important, at least to me.
  50. Here endeth the babble...
  51.  
  52. Running WebCamToo v1.2.1
  53. When you first run WebCamToo it will default to providing support for 1 camera.  If you want more then hold down the COMMAND key ( key) when you run it and it'll prompt you for the number of cameras (1-3).
  54. The program will automatically configure itself and open up a preview window for that camera.  There is one preview window for each supported camera.  So, if you are using 2 cameras then you will have 2 preview windows.
  55. When you first run WebCamToo you will see some junk in the preview window (I just noticed).  Ignore it.  You now need to configure your camera(s).
  56.  
  57. Configuring the camera
  58. Now, you need to configure the camera(s) that WebCamToo will use.  Each camera has a "Camera x Settings…" menu item in the "Edit" menu.  If you select it then you will be presented with a standard Quicktime video input configuration dialog.  It sounds scarey but its really quite simple.  Just play around and it'll make sense.  Oh, if you hit cancel and it tells you there was an SGSettingsDialog() error then don't worry.  Ignore that too.
  59. Once you have configured the camera, you should see the camera image in the preview window.  If you don't then you haven't setup your camera properly so try again.
  60. Now you need to set up your "General Preferences" from the "Edit" menu.
  61.  
  62. General Preferences
  63. Port
  64. Those of you who want to run both a web server, like WebStar, and WebCamToo off the same machine will be pleased to see the Port text box.  This allows you to change which port WebCamToo uses to serve the images.  WebCamToo defaults to using port 80, which is the standard webserver port number.  You can change this to any number you like but be very careful because some port numbers are reserved for specific things.  If you want to change the port number but don't know what value to use then try something above, say, 10000...that should be safe enough.
  65. When you change the port number, all the currently inactive connections will be re-opened on the new port number.  All connections-in-progress will only be moved over to the new port number when they have finished serving their client.  This avoids clients being abruptly cut off...much more pleasant I thought.
  66. Play Sound On Connect
  67. Whenever somebody connects to WebCamToo you can make it play a sound to let you know.  Bear in mind that if your machine gets a lot of hits then this will degrade performance.  That thing just to the bottom-right of the checkbox that looks vaguely like a popup menu is a popup menu.  You can select which sound you would like to hear.  Don't pick a sound that plays for a long time!  Short and sweet is nice and neat, but long and boring will leave clients snoring. (all groan!)
  68. Allow Method Push
  69. This overides any settings that an image requests.  Basically, a server-push (or method push) is a means by which WebCamToo can supply a constant stream of aimges to a webpage that will automatically update on your webpage as fast as possible.  This means that you can have live updating video on a page...very cool.  The downside is...is...is that you might have a lot of traffic generated.  So, if you odn't want people to be able to do this then switch it off.
  70. Max connect time(seconds)
  71. If you are going to allow method push, as is the default, then you can specify how long the stream can stay open for.  A value of "0" (zero) means it can go on until the client (person connecting) decides to go somewhere else.  If you specify a value then it is the number of seconds that that client can get video for.  So, the default is 300 meaning that a client can receive server-pushed video for 300 seconds, or 5 minutes.
  72. If the "Allow Method Push" switch is off (ie. server push is not allowed) then this value has no meaning.
  73. Camera X Caption
  74. WebCamToo can currently support up to 3 camera feeds.  For each camera, you may overide any caption that is requested in the image parameters (more below).  If you leave this text field blank then there will be no caption overides.  If you do specify a caption here then it will be burnt into every image that is sent for that particular camera.  If you wish to time/date stamp your images then you can use the standard parameters that you would supply to the ANSI strftime() call as part of the caption.  For more details on time/date stamping see below.
  75. Do DNS Resolving
  76. Whenever someone logs on to WebCamToo it displays their IP address in the status window.  If DNS resolving is on then it will try to get the symbolic name for the machine. (ie. 194.70.62.18 would become elizium.mmcorp.com)  This makes things much more readable but at a price, DNS resolving will slow things down.  If you get a lot of hits then don't use this.
  77. Log Connections To File
  78. If logging is on then every time someone logs on to WebCamToo it will log their IP address (or symbolic name if DNS is on) to a logfile.  The log file will be stored in the same place as the WebCamToo application and will be called something like "WebCamToo logfile".  If the file doesn't exist it will be created.  If it does exist then loggings will be appended to the file.  When that connection closes it will log the close and the duration of the connection.
  79.  
  80. Windows
  81. You can show/hide all the windows and there are hot-keys to toggle each one.  Its pretty self-explanatory really.
  82. W will hide the topmost window, if any.
  83.  
  84. Status Window
  85. The status window displays little messages when starting up and quitting.  It also displays the IP address of clients that are connecting and disconnecting, or symbolic name if DNS resolving is on (see above).
  86. Peak
  87. The largest number of simultaneous connections dealt with so far since the program was started.
  88. Current
  89. The current number of open connections.
  90. Total
  91. The total number of connections since the program was started.
  92.  
  93. Preferences
  94. Your preferences are automatically loaded and saved when you run/quit.  They are stored in the "Preferences" folder in your "System Folder" should you need to locate them.
  95. Currently the following information is stored in the prefs file:
  96. The port number that WebCamToo works on
  97. The number of cameras currently being used
  98. Whether to play a sound when someone connects
  99. The name of the sound to play (defaults to "WebCamToo Woof" which is part of the app...I didn't have a better one)
  100. Whether server push is allowed
  101. The maximum connect time for server push
  102. Window position of the preview windows and the status window
  103. Captions for each of the cameras
  104. Camera settings for each currently configured camera
  105.  
  106. Basically, when you quit and re-run the program, it should be set to exactly like it was when you quit.  No dialogs should be put up, unless there was a problem, so you should be able to stick an alias to WebCamToo and pop it in your "Startup Items" folder should you so wish.
  107.  
  108. Referencing Images
  109. Okay, the best way to exaplin this is by example.  I will use my machine as the example machine.  Unless otherwise stated, WebCamToo will be serving off port 80 (the default webserver port number).
  110. The following URL is the simplest method for referencing an image.  It will use all the default values for the image:
  111.  
  112. http://elizium.mmcorp.com/
  113.  
  114. This results in a 320x240 image being displayed.  The image is grabbed from the default camera, camera 0.
  115.  
  116. Parameters are specified by preceding the parameter list with a "?" character.  Each parameter is separated by a ";".  The last parameter is not ended with a ";".  Parameter format is "parameter=value", except without the quotes!
  117. Heres an example:
  118.  
  119. http://elizium.mmcorp.com/?width=160;height=120
  120.  
  121. This results in an image that is 160x120 pixels in size, again being grabbed off the default camera 0.
  122.  
  123. So, what if we are running WebCamToo off port number 12345?  Well, we would use the modified url as follows:
  124.  
  125. http://elizium.mmcorp.com:12345/?width=160;height=120
  126.  
  127. Basically, the format for the URL is:
  128.  
  129. http://<host>.<domain>.<suffix>:<port>/?<param=val>;<param=val>;<param=val>
  130.  
  131. but that looks horrible and its confusing so ignore it  8)
  132. So, now we want to stick these images as part of our web page...hmmm, thats very easy to do.  Heres a very simple web page.  To test it, copy the text, paste it into a new text document, save it as "Example1.html" and the load in the file in Netscape.
  133.  
  134. <TITLE>Example 1</TITLE>
  135. <H1>Example 1</H1><P>
  136. Heres an example picture.  If the image comes up with a broken image
  137. icon then don't worry, its just that my machine is down<P>
  138. <IMG SRC="http://elizium.mmcorp.com/?width=160;height=120">
  139. <P>There you go
  140.  
  141. Okay, so its very crude but you can see how to do the image tag...its the standard image tag and theres plenty of docs about it on the net so I won't go into that.
  142.  
  143. Supported Tags
  144. Heres a list of all the tags that WebCamToo currently supports, along with a description.
  145.  
  146. Tag                                                    Example                                                            Notes
  147. width                                            width=160
  148. height                                        height=120
  149. method                                        method=push                                            only method=push works.  all other values make it use the
  150.                                       default method of pull (still image)
  151. camera                                        camera=0                                                        values 0-2 are accepted.  Illegal value uses default
  152.                                                                 camera=1
  153.                                                                 camera=2
  154. caption                                    caption=nice carpet            caption cannot have ; or = or ? in it.  use '|' for a new
  155.                                       line
  156.                 caption=line|another  shows "line" on one line and "another" below it
  157.                                                                 caption=local time is %X
  158. font                                                font=newyork                                        applies the font to the caption
  159.                                                                 font=geneva
  160.                                                                 font=monaco
  161.                                                                 font=times
  162.                                                                 font=helvetica
  163.                                                                 font=courier
  164.                                                                 font=chicago
  165. face                                                face=biuosce                                        bold, italic, underline, outline, shadow, condense, extend
  166. size                                                size=12                                                            you can use any value here
  167. transfer                                transfer=or                                            specifies transfer mode which text is drawn with
  168.                                                                 transfer=xor
  169.                                                                 transfer=bic
  170.                                                                 transfer=copy                                    actually, any illegal value defaults to copy mode
  171. forecolour                        forecolour=black                        colour that text is written with (note UK spelling!)
  172.                                                                 forecolour=white
  173.                                                                 forecolour=red
  174.                                                                 forecolour=green
  175.                                                                 forecolour=blue
  176.                                                                 forecolour=cyan
  177.                                                                 forecolour=magenta
  178.                                                                 forecolour=yellow
  179. backcolour                        backcolour=white                            background colour that text is drawn onto (see forecolor)
  180. position                                position=topleft                            position in image where caption is drawn
  181.                                                                 position=topmiddle
  182.                                                                 position=topright
  183.                                                                 position=middleright
  184.                                                                 position=bottomright
  185.                                                                 position=bottommiddle
  186.                                                                 position=bottomleft
  187.                                                                 position=middleleft
  188.                                                                 position=middlemiddle
  189. maxtime                                    maxtime=300                                            max time in seconds that pushed image will be updated for
  190.  
  191. Note: caption can be overidden by the application if one has been set for that camera in the "General Preferences"
  192. Note: maxtime can be overidden by the application in the "General Preferences"
  193.  
  194. Time/Date Stamping
  195. You can add time/date stamps as part of your caption.  It uses the same format as the ANSI strftime() call documented in time.h
  196. For those not having the docs, heres the supported options:
  197.  
  198. %a                        abbreviated weekday
  199. %A                        full weekday
  200. %b                        abbreviated month
  201. %B                        full month
  202. %c                        date/time formatted as Mon Nov 5 13:54:23 1996
  203. %d                        day of month as decimal (01-31)
  204. %H                        hour (00-23)
  205. %I                        hour (01-12)
  206. %j                        day of year (001-366)
  207. %m                        month (01-12)
  208. %M                        minute (00-59)
  209. %p                        AM/PM for 12-hour clock
  210. %S                        seconds (00-59)
  211. %U                        week number of year with sunday as first day of week (00-53)
  212. %w                        weekday as number (0 Sunday - 6 Saturday)
  213. %W                        week number of year with Monday as first day of week (00-53)
  214. %x                        date as 01/25/96
  215. %X                        time as 1:59 PM
  216. %y                        year without century (00-99)
  217. %Y                        year with century (1900-1999 I think)
  218. %%                        %  (prints the % sign in case you wanted it)
  219.  
  220. Heres some examples (quote marks are for clarity and should not be included):
  221. a caption of
  222. "the time here is %X and I like books"
  223. would result in something like
  224. "the time here is 7:42 AM and I like books"
  225. a caption of
  226. %A, %d %B %Y, %I:%M:%S %p
  227. would result in something like
  228. Thursday, 23 June 1996, 05:15:30 PM
  229.  
  230. Known Bugs
  231. WebCamToo has only ever crashed on me twice, both at the same point.  I run it pratically all day every day on my machine at work (which I use to develop software).  Whilst everything is crashing, WebCamToo stays up serving images to one and all.  As with all things, its not perfect...heres some bugs that I or others have come across.
  232. •Crash when opening the "Camera X Settings…" whilst images are being served.  No idea why, only ever happened twice.  Will investigate this when I have more time.
  233. •Some problems using various RasterOps boards for digitising.  I don't have any of these boards so I can't test this easily.  I'll do what I can but, as I said, I am busy and I don't have any boards...someone wanna donate one to me? Boards that WebCamToo didn't like include Rasterops 24XLTV and Rasterops XTV.  Anyone have any ideas?  I reckon that maybe the board doesn't have a proper Quicktime vdig.
  234. •68k macs don't work...yeah yeah, I know.  PowerPC only I'm afraid.  I'll work on the 68k compatibility some other time.
  235. •using built-in video (like on an AV) and plugging a camera into the s-video port and another camera into the composite video port will not work.  This isn't a bug!  It's because the board only has 1 grabber.  You'll either get 1 okay signal or you'll get 2 mushed signals.
  236. •going into the camera settings dialog, having already set the camera up, doesn't always start with the same camera settings as before...I know, its because I'm cheating when you I re-initialise the camera.  I'll fix this.
  237.  
  238. Bugs
  239. If you think you have found  bug then email (address below) me giving me as much information as you possibly can.  If you have Macsbug, or some other degubber, installed then do a stack crawl and tell me which function it died in (I build using traceback tables), how it crashed, any error messages, machine configuration...etc
  240.  
  241. Suggestions
  242. Email me with your suggestions.  I will try to implement everything that people ask for.  Make em weird, wacky, obvious or whatever.  I will do my best.
  243.  
  244. Disclaimer
  245. Use this program at your own risk.  I shall not be held accountable for any damage direct or indirect caused by the use of this program.  Use of this program is solely the responsibility of the person running it.  You are accountable for your own actions.  You may not distribute this program without this accompanying document.  You may not charge for this program in any way, that includes transmission fees charged by some service providers who charge money for transferring files to and from the internet.  You may not distribute this program on public domain CD/floppys (or any other medium).  If you don't like the terms then don't use the program.
  246.  
  247. Special Request
  248. If you use WebCamToo, please credit me and stick a link to my WebCamToo homepage:
  249. http://www.mmcorp.com/~binky/webcam2.html
  250. Also, if you do run WebCamToo then tell me the address of the page and I'll compile a list of WebCamToo sites and link to them all from my WebCamToo homepage.  I'd like to get some idea as to just how many people are using it.
  251. Tell your friends and families about the joys of WebCamToo...flaunt it!  Show it in action,  show views out your window, let's see what different places and people look like!  Get connected, get addicted!
  252.  
  253. Getting the latest information
  254. If you are interested in being notified of the latest releases/developments of WebCamToo, mail me and I'll add your name to the mailing list.  I won't mailbomb you with junkmail! (honest)
  255.  
  256. Contacting me
  257. Email: binky@mmcorp.com
  258. Web: http://www.mmcorp.com/~binky/
  259.  
  260. Credits
  261. Big thanks go to all of you who are already running WebCamToo.  I've had emails from lots of people, all who have had suggestions and all of which are having a lot of fun with it.  I won't start naming names here because I haven't asked them if I can use their names and, besides, that would be putting some WebCammers before others...we're all equal (even the pigs are, Mr Orwell!)
  262.  
  263. Future Features
  264. PC version is being worked on...no dates yet. its still early days!
  265. rotate (got the code...just gotta stick it in place)
  266. mirror (ditto)
  267. pixellate (ditto again)
  268. magnify(pos,factor)
  269. stereograms (can anyone help me with this?  a simple colour generator with a very simple API)
  270. stats(connection/uptime...)
  271. quicktake support (any ever tried writing code to get images from a Quicktake?)
  272. serve HTML text documents
  273. support different image types (GIF, PICT, BMP, ???)
  274. ability to speak messages sent by the client (messages sent in a FORM structure that WCT extracts and speaks to the person running WCT...that might be fun)
  275. serve image on the WCT machine's desktop (broadcasts WCT screen as opposed to a camera feed...a la WebCam v1)
  276. dynamic stream allocation (as opposed to constantly having all streams open all the time)
  277.  
  278. Written in C, NOT C++ !
  279. Compiled using Metrowerks Codewarrior 9
  280. 6 June 1996
  281.  
  282. Hope you enjoy it!
  283. Binky
  284.  
  285. ps. these docs are becoming more like a diary of stuff that I'm thinking about whilst I add features.  Is that a bad thing?